class Fib(object):
    def __init__(self):
        self.a, self.b = 0, 1

    def __iter__(self):
        return self

    def __getitem__(self, n):
        a, b = 1, 1
        for x in range(n):
            a, b = b, a + b
        return a

    def __getattr__(self, attr):
        if attr == 'score':
            return 99

    def next(self):
        self.a, self.b = self.b, self.a + self.b
        if self.a > 100000:
            raise StopIteration()
        return self.a


class Chain(object):
    def __init__(self, path='', name=''):
        self._path = path
        self._name = name

    def __getattr__(self, path):
        return Chain('%s/%s' % (self._path, path))

    def __str__(self):
        return self._path


def main():
    f = Fib()
    for n in f:
        print(n)

    print "----------"
    print(f[5])
    print "----------"
    print(f.score)

    print "---------------"
    c = Chain()
    print(c.users.a.repos)


if __name__ == '__main__':
    main()
